{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nimport { convertChildrenToData } from \"../utils/legacyUtil\";\nfunction parseSimpleTreeData(treeData, _ref) {\n  var id = _ref.id,\n    pId = _ref.pId,\n    rootPId = _ref.rootPId;\n  var keyNodes = {};\n  var rootNodeList = []; // Fill in the map\n\n  var nodeList = treeData.map(function (node) {\n    var clone = _objectSpread({}, node);\n    var key = clone[id];\n    keyNodes[key] = clone;\n    clone.key = clone.key || key;\n    return clone;\n  }); // Connect tree\n\n  nodeList.forEach(function (node) {\n    var parentKey = node[pId];\n    var parent = keyNodes[parentKey]; // Fill parent\n\n    if (parent) {\n      parent.children = parent.children || [];\n      parent.children.push(node);\n    } // Fill root tree node\n\n    if (parentKey === rootPId || !parent && rootPId === null) {\n      rootNodeList.push(node);\n    }\n  });\n  return rootNodeList;\n}\n/**\n * Convert `treeData` or `children` into formatted `treeData`.\n * Will not re-calculate if `treeData` or `children` not change.\n */\n\nexport default function useTreeData(treeData, children, simpleMode) {\n  return React.useMemo(function () {\n    if (treeData) {\n      return simpleMode ? parseSimpleTreeData(treeData, _objectSpread({\n        id: 'id',\n        pId: 'pId',\n        rootPId: null\n      }, simpleMode !== true ? simpleMode : {})) : treeData;\n    }\n    return convertChildrenToData(children);\n  }, [children, simpleMode, treeData]);\n}","map":{"version":3,"names":["_objectSpread","React","convertChildrenToData","parseSimpleTreeData","treeData","_ref","id","pId","rootPId","keyNodes","rootNodeList","nodeList","map","node","clone","key","forEach","parentKey","parent","children","push","useTreeData","simpleMode","useMemo"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/rc-tree-select/es/hooks/useTreeData.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nimport { convertChildrenToData } from \"../utils/legacyUtil\";\n\nfunction parseSimpleTreeData(treeData, _ref) {\n  var id = _ref.id,\n      pId = _ref.pId,\n      rootPId = _ref.rootPId;\n  var keyNodes = {};\n  var rootNodeList = []; // Fill in the map\n\n  var nodeList = treeData.map(function (node) {\n    var clone = _objectSpread({}, node);\n\n    var key = clone[id];\n    keyNodes[key] = clone;\n    clone.key = clone.key || key;\n    return clone;\n  }); // Connect tree\n\n  nodeList.forEach(function (node) {\n    var parentKey = node[pId];\n    var parent = keyNodes[parentKey]; // Fill parent\n\n    if (parent) {\n      parent.children = parent.children || [];\n      parent.children.push(node);\n    } // Fill root tree node\n\n\n    if (parentKey === rootPId || !parent && rootPId === null) {\n      rootNodeList.push(node);\n    }\n  });\n  return rootNodeList;\n}\n/**\n * Convert `treeData` or `children` into formatted `treeData`.\n * Will not re-calculate if `treeData` or `children` not change.\n */\n\n\nexport default function useTreeData(treeData, children, simpleMode) {\n  return React.useMemo(function () {\n    if (treeData) {\n      return simpleMode ? parseSimpleTreeData(treeData, _objectSpread({\n        id: 'id',\n        pId: 'pId',\n        rootPId: null\n      }, simpleMode !== true ? simpleMode : {})) : treeData;\n    }\n\n    return convertChildrenToData(children);\n  }, [children, simpleMode, treeData]);\n}"],"mappings":"AAAA,OAAOA,aAAa,MAAM,0CAA0C;AACpE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,qBAAqB,QAAQ,qBAAqB;AAE3D,SAASC,mBAAmB,CAACC,QAAQ,EAAEC,IAAI,EAAE;EAC3C,IAAIC,EAAE,GAAGD,IAAI,CAACC,EAAE;IACZC,GAAG,GAAGF,IAAI,CAACE,GAAG;IACdC,OAAO,GAAGH,IAAI,CAACG,OAAO;EAC1B,IAAIC,QAAQ,GAAG,CAAC,CAAC;EACjB,IAAIC,YAAY,GAAG,EAAE,CAAC,CAAC;;EAEvB,IAAIC,QAAQ,GAAGP,QAAQ,CAACQ,GAAG,CAAC,UAAUC,IAAI,EAAE;IAC1C,IAAIC,KAAK,GAAGd,aAAa,CAAC,CAAC,CAAC,EAAEa,IAAI,CAAC;IAEnC,IAAIE,GAAG,GAAGD,KAAK,CAACR,EAAE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